package com.matt.domain.materials;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.matt.commons.model.Model;
import java.sql.Timestamp;
import javax.persistence.*;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
@Table(name = "materiels")
@Entity
public class Materiels extends Model {
  @Column(name = "aid", columnDefinition = " varchar(32) COMMENT '对应园区id' ")
  private String aid;

  /**
   * 物资名称
   */
  @Column(name = "name", columnDefinition = " varchar(50) COMMENT '物资名称' ")
  private String name;

  /**
   * 物资分类
   */
//  @Column(name = "cid")
//  private String cid;

  @ManyToOne
  @JoinColumn(name = "cid", columnDefinition = " varchar(32) COMMENT '分类id' ")
  private  MaterielCategory category;

  /**
   * 库存
   */
  @Column(name = "stockCount", columnDefinition = " int default 0 COMMENT '库存' ")
  private Integer stockCount = 0;

  /**
   * 总数
   */
  @Column(name = "allCount", columnDefinition = " int default 0 COMMENT '总数' ")
  private Integer allCount = 0;

  /**
   * 损耗
   */
  @Column(name = "loss", columnDefinition = " int default 0 COMMENT '损耗' ")
  private Integer loss = 0;

  /**
   * 借出总数
   */
  @Column(name = "allBorrow", columnDefinition = " int default 0 COMMENT '借出总数' ")
  private Integer allBorrow = 0;

  /**
   * 消耗
   */
  @Column(name = "allConsumed", columnDefinition = " int default 0 COMMENT '消耗，被使用，被领用计数器' ")
  private Integer allConsumed = 0;

  /**
   * 创建时间
   */
  @Column(name = "created", nullable = false, columnDefinition = " datetime DEFAULT NOW() COMMENT '创建时间' ")
  private Timestamp created;

  @Column(columnDefinition = " bit DEFAULT 0 COMMENT '是否删除 0：否，1是' ")
  private Boolean deleted = false;

  /**
   * 消耗性物品
   */
  @Column(columnDefinition = " bit DEFAULT 0 COMMENT '消耗性物品 0：否，1是' ")
  private Boolean consumable = false;
}